Survive absence of librsvg without criticals
authorMatthias Clasen <mclasen@redhat.com>
Thu, 18 Apr 2019 00:12:34 +0000 (00:12 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 18 Apr 2019 00:14:00 +0000 (00:14 +0000)
We can't guarantee that we can load svgs, so
we shouldn't spew criticals when some of our
own resources fail to load due to that reason.

gtk/tools/gdkpixbufutils.c

index 0ed23bd3dcdc4b78835a749d82276859f83f2598..0f4b7f09b5903365ac712984031ecdbb33c07c56 100644 (file)
@@ -364,11 +364,14 @@ gtk_make_symbolic_texture_from_resource (const char  *path,
                                          GError     **error)
 {
   GdkPixbuf *pixbuf;
-  GdkTexture *texture;
+  GdkTexture *texture = NULL;
 
   pixbuf = gtk_make_symbolic_pixbuf_from_resource (path, width, height, scale, error);
-  texture = gdk_texture_new_for_pixbuf (pixbuf);
-  g_object_unref (pixbuf);
+  if (pixbuf)
+    {
+      texture = gdk_texture_new_for_pixbuf (pixbuf);
+      g_object_unref (pixbuf);
+    }
 
   return texture;
 }